<template>
  <div id="slider" class="mui-slider">
    <div id="sliderSegmentedControl" class="mui-scroll-wrapper mui-slider-indicator mui-segmented-control mui-segmented-control-inverted">
      <div class="mui-scroll">
        <span :class="['mui-control-item', {'mui-active': list.active }]" v-for="(list, key) in requireTabData" :key="key" @click="changeListData(list.type)">
          {{ list.title }}
        </span>
      </div>
    </div>
  </div>
</template>

<script>
import mui from '../assets/mui/js/mui.min.js'
export default {
  props : ['requireTabData'],
  methods: {
    changeListData (type) {
      this.$root.Bus.$emit('changeRequireCartgory',type);
    }
  },
  mounted() {
    mui('.mui-scroll-wrapper').scroll({
      deceleration: 0.0005, //flick 减速系数，系数越大，滚动速度越慢，滚动距离越小，默认值0.0006
      scrollX: true, //是否横向滚动
    });
  }
}
</script>

<style lang="scss" scoped>
@import url("../assets/mui/css/mui.min.css"); /* no */
.mui-slider {
  border-top: 1px solid #eee; /* no */
  border-bottom: 1px solid #eee; /* no */
}
.mui-segmented-control.mui-scroll-wrapper {
  height: 80px;
  .mui-scroll {
    display: flex;
    justify-content: center;
    align-items: center;
    height: 80px;
    .mui-control-item {
      margin: 0 35px;
      padding: 0;
      color: #666;
      font-size: 30px;
      height: 100%;
      line-height: 80px;
    }
    .mui-control-item.mui-active {
      color: #d9271b;
      border-bottom: 1px solid #d9271b; /* no */
    }
  }
}

</style>

